<template>
	<interaction ref="interaction"></interaction>
</template>

<script>
import Interaction from './interaction.vue';
import { getLocationHref, getWxShareHref } from '../../common/utils.js';
export default {
	onLoad(option) {
		uni.loadFontFace({
			family: 'din',
			source: 'url("https://mall-rongchuang.oss-cn-beijing.aliyuncs.com/guixin_miniProgram/fonts/date_font.ttf")',
			success() {}
		});
	},
	components: {
		Interaction
	},
	onShow() {
		this.$nextTick(() => {
			this.$refs.interaction.getSomeData();
		})
	},
	async onShareAppMessage(res) {
		if(res.from === 'menu') {
			return {
				title: '融创服务 | 聚友趣',
				// #ifdef MP-WEIXIN
				path: getLocationHref({go: '/interaction/diary/index'}),
				// #endif
				// #ifdef H5
				path: getWxShareHref({go: '/interaction/diary/index'}),
				// #endif
			}
		} else {
			const { title, path, imageUrl } = await this.$refs.interaction.getSharePhoto();
			this.showShare = false;
			return {
				title,
				path,
				imageUrl,
			};
		}
	},
	onPullDownRefresh() {
		this.$refs.interaction.getSomeData();
		setTimeout(function() {
			uni.stopPullDownRefresh();
		}, 1000);
	},
	data() {
		return {};
	},
	methods: {
		updateDirayInfo(data) {
			this.$refs.interaction.$refs.diray.getBeautifulDiaryList();
		}
	}
};
</script>
